package com.jasen.springcloud.controller;

import com.jasen.springcloud.entities.Dept;
import com.jasen.springcloud.service.DeptConsumerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class DeptController_Consumer {

    @Autowired
    private DeptConsumerService deptConsumerService;

    @RequestMapping(value="/consumer/dept/add")
    public boolean add(Dept dept)
    {
        return deptConsumerService.add(dept);
    }

    @RequestMapping(value="/consumer/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id)
    {
        return deptConsumerService.get(id);
    }

    @SuppressWarnings("unchecked")
    @RequestMapping(value="/consumer/dept/list")
    public List<Dept> list()
    {
        return deptConsumerService.list();
    }

    @RequestMapping(value="/consumer/dept/discovery")
    public Object discovery()
    {
        return deptConsumerService.discovery();
    }
}